{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "baseline found:\n",
      "[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6, 6, 6, 7, 8, 8, 8]\n",
      "AAD found:\n",
      "[0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 7, 8, 9, 9, 9, 10, 11, 12, 13, 14, 14, 14, 15]\n",
      "UNK  4\n",
      "UNK  4\n",
      "UNK  4\n",
      "UNK  4\n"
     ]
    }
   ],
   "source": [
    "import logging\n",
    "import numpy as np\n",
    "\n",
    "from ad_examples.common.gen_samples import get_synthetic_samples\n",
    "from ad_examples.aad.aad_globals import AadOpts, get_aad_command_args\n",
    "from ad_examples.common.utils import configure_logger\n",
    "from ad_examples.aad.forest_description import CompactDescriber, MinimumVolumeCoverDescriber, \\\n",
    "    BayesianRulesetsDescriber, get_region_memberships\n",
    "\n",
    "from ad_examples.aad.demo_aad import get_debug_args, detect_anomalies_and_describe\n",
    "\n",
    "logger = logging.getLogger(__name__)\n",
    "\n",
    "# Prepare the aad arguments. It is easier to first create the parsed args and\n",
    "# then create the actual AadOpts from the args\n",
    "args = get_aad_command_args(debug=True, debug_args=get_debug_args())\n",
    "\n",
    "# configure_logger(args)  # create a ./temp folder in case you need debug logs\n",
    "\n",
    "opts = AadOpts(args)\n",
    "logger.debug(opts.str_opts())\n",
    "\n",
    "np.random.seed(opts.randseed)\n",
    "\n",
    "# load synthetic (toy 2) dataset\n",
    "x, y = get_synthetic_samples(stype=2)\n",
    "\n",
    "# run interactive anomaly detection loop\n",
    "model, x_transformed, queried, ridxs_counts, region_extents = detect_anomalies_and_describe(x, y, opts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
